<?php

namespace JLPay\Models\Openmerch\Register;

use JLPay\Models\BaseResponse;

/**
 * 进件查询响应
 */
class IncomingQueryResponse extends BaseResponse
{
    protected ?string $applyId = null;
    protected ?string $auditStatus = null;
    protected ?array $auditDetail = null;
    protected ?string $auditFailure = null;
    protected ?string $merchNo = null;
    protected ?string $signId = null;
    protected ?string $signStatus = null;
    protected ?string $signUrl = null;
    protected ?string $signDelegateeId = null;
    protected ?string $signDelegateeStatus = null;
    protected ?string $signDelegateeUrl = null;
    protected ?string $termNo = null;
    protected ?string $auditEndTime = null;
    protected ?string $unionpayReportRet = null;
    protected ?string $unionpayReportMsg = null;
    protected ?string $wechatReportRet = null;
    protected ?string $wechatReportMsg = null;
    protected ?string $alipayReportRet = null;
    protected ?string $alipayReportMsg = null;
    protected ?string $subAppidBindRet = null;
    protected ?string $subAppidBindMsg = null;
    protected ?array $functions = null;

    /**
     * 构造函数
     *
     * @param array|null $responseArray
     */
    public function __construct(?array $responseArray = null)
    {
        parent::__construct($responseArray);
        
        if ($responseArray) {
            $this->applyId = $responseArray['apply_id'] ?? null;
            $this->auditStatus = $responseArray['audit_status'] ?? null;
            $this->auditDetail = $responseArray['audit_detail'] ?? null;
            $this->auditFailure = $responseArray['audit_failure'] ?? null;
            $this->merchNo = $responseArray['merch_no'] ?? null;
            $this->signId = $responseArray['sign_id'] ?? null;
            $this->signStatus = $responseArray['sign_status'] ?? null;
            $this->signUrl = $responseArray['sign_url'] ?? null;
            $this->signDelegateeId = $responseArray['sign_delegatee_id'] ?? null;
            $this->signDelegateeStatus = $responseArray['sign_delegatee_status'] ?? null;
            $this->signDelegateeUrl = $responseArray['sign_delegatee_url'] ?? null;
            $this->termNo = $responseArray['term_no'] ?? null;
            $this->auditEndTime = $responseArray['audit_end_time'] ?? null;
            $this->unionpayReportRet = $responseArray['unionpay_report_ret'] ?? null;
            $this->unionpayReportMsg = $responseArray['unionpay_report_msg'] ?? null;
            $this->wechatReportRet = $responseArray['wechat_report_ret'] ?? null;
            $this->wechatReportMsg = $responseArray['wechat_report_msg'] ?? null;
            $this->alipayReportRet = $responseArray['alipay_report_ret'] ?? null;
            $this->alipayReportMsg = $responseArray['alipay_report_msg'] ?? null;
            $this->subAppidBindRet = $responseArray['sub_appid_bind_ret'] ?? null;
            $this->subAppidBindMsg = $responseArray['sub_appid_bind_msg'] ?? null;
            $this->functions = $responseArray['functions'] ?? null;
        }
    }

    /**
     * 获取业务申请编号
     *
     * @return string|null
     */
    public function getApplyId(): ?string
    {
        return $this->applyId;
    }

    /**
     * 获取审核状态
     *
     * @return string|null
     */
    public function getAuditStatus(): ?string
    {
        return $this->auditStatus;
    }

    /**
     * 获取审核驳回详情
     *
     * @return array|null
     */
    public function getAuditDetail(): ?array
    {
        return $this->auditDetail;
    }

    /**
     * 获取审核驳回描述
     *
     * @return string|null
     */
    public function getAuditFailure(): ?string
    {
        return $this->auditFailure;
    }

    /**
     * 获取商户号
     *
     * @return string|null
     */
    public function getMerchNo(): ?string
    {
        return $this->merchNo;
    }

    /**
     * 获取协议编号
     *
     * @return string|null
     */
    public function getSignId(): ?string
    {
        return $this->signId;
    }

    /**
     * 获取签约状态
     *
     * @return string|null
     */
    public function getSignStatus(): ?string
    {
        return $this->signStatus;
    }

    /**
     * 获取协议链接
     *
     * @return string|null
     */
    public function getSignUrl(): ?string
    {
        return $this->signUrl;
    }

    /**
     * 获取委托合同协议编号
     *
     * @return string|null
     */
    public function getSignDelegateeId(): ?string
    {
        return $this->signDelegateeId;
    }

    /**
     * 获取被授权人的签约状态
     *
     * @return string|null
     */
    public function getSignDelegateeStatus(): ?string
    {
        return $this->signDelegateeStatus;
    }

    /**
     * 获取被授权人的签约链接
     *
     * @return string|null
     */
    public function getSignDelegateeUrl(): ?string
    {
        return $this->signDelegateeUrl;
    }

    /**
     * 获取终端号
     *
     * @return string|null
     */
    public function getTermNo(): ?string
    {
        return $this->termNo;
    }

    /**
     * 获取审核时间
     *
     * @return string|null
     */
    public function getAuditEndTime(): ?string
    {
        return $this->auditEndTime;
    }

    /**
     * 获取银联渠道报备结果
     *
     * @return string|null
     */
    public function getUnionpayReportRet(): ?string
    {
        return $this->unionpayReportRet;
    }

    /**
     * 获取银联报备结果描述
     *
     * @return string|null
     */
    public function getUnionpayReportMsg(): ?string
    {
        return $this->unionpayReportMsg;
    }

    /**
     * 获取微信渠道报备结果
     *
     * @return string|null
     */
    public function getWechatReportRet(): ?string
    {
        return $this->wechatReportRet;
    }

    /**
     * 获取微信报备结果描述
     *
     * @return string|null
     */
    public function getWechatReportMsg(): ?string
    {
        return $this->wechatReportMsg;
    }

    /**
     * 获取支付宝渠道报备结果
     *
     * @return string|null
     */
    public function getAlipayReportRet(): ?string
    {
        return $this->alipayReportRet;
    }

    /**
     * 获取支付宝报备结果描述
     *
     * @return string|null
     */
    public function getAlipayReportMsg(): ?string
    {
        return $this->alipayReportMsg;
    }

    /**
     * 获取appid绑定结果
     *
     * @return string|null
     */
    public function getSubAppidBindRet(): ?string
    {
        return $this->subAppidBindRet;
    }

    /**
     * 获取appid绑定结果描述
     *
     * @return string|null
     */
    public function getSubAppidBindMsg(): ?string
    {
        return $this->subAppidBindMsg;
    }

    /**
     * 获取业务开通情况
     *
     * @return array|null
     */
    public function getFunctions(): ?array
    {
        return $this->functions;
    }

    /**
     * 转换为数组
     *
     * @return array
     */
    public function toArray(): array
    {
        $data = parent::toArray();
        
        if ($this->applyId) {
            $data['apply_id'] = $this->applyId;
        }
        if ($this->auditStatus) {
            $data['audit_status'] = $this->auditStatus;
        }
        if ($this->auditDetail) {
            $data['audit_detail'] = $this->auditDetail;
        }
        if ($this->auditFailure) {
            $data['audit_failure'] = $this->auditFailure;
        }
        if ($this->merchNo) {
            $data['merch_no'] = $this->merchNo;
        }
        if ($this->signId) {
            $data['sign_id'] = $this->signId;
        }
        if ($this->signStatus) {
            $data['sign_status'] = $this->signStatus;
        }
        if ($this->signUrl) {
            $data['sign_url'] = $this->signUrl;
        }
        if ($this->signDelegateeId) {
            $data['sign_delegatee_id'] = $this->signDelegateeId;
        }
        if ($this->signDelegateeStatus) {
            $data['sign_delegatee_status'] = $this->signDelegateeStatus;
        }
        if ($this->signDelegateeUrl) {
            $data['sign_delegatee_url'] = $this->signDelegateeUrl;
        }
        if ($this->termNo) {
            $data['term_no'] = $this->termNo;
        }
        if ($this->auditEndTime) {
            $data['audit_end_time'] = $this->auditEndTime;
        }
        if ($this->unionpayReportRet) {
            $data['unionpay_report_ret'] = $this->unionpayReportRet;
        }
        if ($this->unionpayReportMsg) {
            $data['unionpay_report_msg'] = $this->unionpayReportMsg;
        }
        if ($this->wechatReportRet) {
            $data['wechat_report_ret'] = $this->wechatReportRet;
        }
        if ($this->wechatReportMsg) {
            $data['wechat_report_msg'] = $this->wechatReportMsg;
        }
        if ($this->alipayReportRet) {
            $data['alipay_report_ret'] = $this->alipayReportRet;
        }
        if ($this->alipayReportMsg) {
            $data['alipay_report_msg'] = $this->alipayReportMsg;
        }
        if ($this->subAppidBindRet) {
            $data['sub_appid_bind_ret'] = $this->subAppidBindRet;
        }
        if ($this->subAppidBindMsg) {
            $data['sub_appid_bind_msg'] = $this->subAppidBindMsg;
        }
        if ($this->functions) {
            $data['functions'] = $this->functions;
        }
        
        return $data;
    }
} 